package cn.eud.hunau;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import cn.eud.hunau.common.JwtInterceptor;

@Configuration
class WebConfig implements WebMvcConfigurer {
    @Autowired
    private JwtInterceptor jwtInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtInterceptor)
                .addPathPatterns("/movie/**", "/user/**")
                .excludePathPatterns("/user/login", "/user/register");
    }
}

@SpringBootApplication// Spring Boot 项目的入口注解，包含了自动配置等功能。
@MapperScan("cn.eud.hunau.mapper")// 自动扫描这个包下所有的接口，即使接口上没有 @Mapper 注解，也会帮你注册到 Spring 容器中。
public class SpringBoot3StructApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringBoot3StructApplication.class, args);
    }

}
